<?php
class SP_Database_Table
{
	private $name;
	private $base;
	
	function __construct($name,$base)
	{
		$this->name=$name;
		$this->base=$base;
	}
	public function getRecord($query)
	{
		if(SP_Helpers_Checker::checkID($query))
		{
			$query="SELECT * FROM ".$this->name." WHERE id='$query'";
		}

		$this->base->query($query);
		if ($this->base->getResult())
		{
			if($this->base->getNumRows()==1)
			{
				return new SP_Database_Record($this->base->fetchAssoc());
			}
			else
			{
				while($row=$this->base->fetchAssoc())
				{
					$mas[]=new SP_Database_Record($row);
				}
				return $mas;
			}
		}
		else
		{
			return NULL;
		}
	}
}
?>